﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Portas.aspx.cs" Inherits="WCFPortas.Portas" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Controle de portas de serviços</title>
    <link href="Estilos.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function setUpdateItem(pObjTR)
        {
            document.getElementById('hdnModulo').value = pObjTR.childNodes[0].innerText;
            document.getElementById('hdnSubmodulo').value = pObjTR.childNodes[1].innerText;
            document.getElementById('hdnServico').value = pObjTR.childNodes[2].innerText;
            document.getElementById('ddlModuloI').value = pObjTR.childNodes[0].innerText;
            document.getElementById('txtSubModulo').value = pObjTR.childNodes[1].innerText;
            document.getElementById('txtServico').value = pObjTR.childNodes[2].innerText;
            document.getElementById('txtPortaTCP').value = pObjTR.childNodes[3].innerText;
            document.getElementById('txtPortaMEX').value = pObjTR.childNodes[4].innerText;
        }
        
        function novo()
        {
            document.getElementById('hdnModulo').value = '';
            document.getElementById('hdnSubmodulo').value = '';
            document.getElementById('hdnServico').value = '';
            document.getElementById('ddlModuloI').value = '';
            document.getElementById('txtSubModulo').value = '';
            document.getElementById('txtServico').value = '';
            document.getElementById('txtPortaTCP').value = '';
            document.getElementById('txtPortaMEX').value = '';
        }
        
        function setarValorPortas(porta, portaMex)
        {
            //document.getElementById('txtPortaTCP').value = porta;
            //document.getElementById('txtPortaMEX').value = portaMex;
        }
    
    
    </script>
</head>
<body>
    <form id="wfrmPortas" runat="server">
    <table cellpadding="0" cellspacing="0" width="100%">
       <tr>
        <td style="width: 100%;">
            <table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td style="width: 100%;">
                       <fieldset>
                            <legend>
                                Pesquisa de Portas
                            </legend>
                            <table cellpadding="0" cellspacing="0" width="100%">
                                <tr>
                                    <td style="width: 5%;">Módulo</td>
                                    <td style="width: 25%;" align="left">&nbsp;
                                        <asp:DropDownList ID="ddlModulos" runat="server" AutoPostBack="true" 
                                            onselectedindexchanged="ddlModulos_SelectedIndexChanged">
                                        </asp:DropDownList>&nbsp;
                                            </td>
                                    <td style="width: 17%;" align="right">Sub Módulo</td>
                                    <td style="width: 53%;" align="left">&nbsp;<asp:DropDownList ID="ddlSubModulos" runat="server" 
                                            onselectedindexchanged="ddlSubModulos_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>&nbsp;</td>
                                </tr>
                            </table>
                      </fieldset>
                    </td>
                </tr>
                <tr>
                    <td><input type="hidden" id="hdnModulo" runat="server" /> <input type="hidden" id="hdnSubmodulo" runat="server" /> <input type="hidden" id="hdnServico" runat="server" /><input type="hidden" id="hdnPorta" runat="server" /><input type="hidden" id="hdnPortaMex" runat="server" /> &nbsp;</td>
                    
                </tr>
                <tr>
                    <td>
                        <fieldset>
                                <legend>
                                    Inserção/Alteração de Portas
                                </legend>
                                <table cellpadding="0" cellspacing="0" width="100%">
                                    <tr>
                                        <td style="width: 5%;">Módulo</td>
                                        <td style="width: 10%;" align="left">&nbsp;
                                            <asp:DropDownList ID="ddlModuloI" runat="server" ></asp:DropDownList>&nbsp;
                                                </td>
                                        <td style="width: 10%;" align="right">Sub Módulo</td>
                                        <td style="width: 10%;" align="left">&nbsp;<asp:TextBox ID="txtSubModulo" runat="server"></asp:TextBox>&nbsp;</td>
                                        <td style="width: 5%;" align="right" >Serviço</td>
                                        <td style="width: 10%;"   align="left">&nbsp;
                                            <asp:TextBox ID="txtServico" runat="server" Enabled="False"></asp:TextBox>
                                        </td>
                                        <td style="width: 10%;" align="right">Porta TCP</td>
                                        <td style="width: 10%;" align="left">&nbsp;
                                            <asp:TextBox ID="txtPortaTCP" runat="server" Width="70px" Enabled="False"></asp:TextBox>&nbsp;
                                        </td>
                                        <td style="width: 10%;" align="right">Porta MEX</td>
                                        <td style="width: 10%;" align="left">&nbsp;
                                            <asp:TextBox ID="txtPortaMEX" runat="server" Width="70px" Enabled="False"></asp:TextBox>
                                        </td>
                                        <td style="width: 10%;" align="right">&nbsp;<asp:Button ID="btnSalvar" 
                                                runat="server" Text="Salvar" onclick="btnSalvar_Click" />
                                        </td>
                                        <td style="width: 10%;" align="right">&nbsp;
                                            <asp:Button ID="btnLimpar" 
                                                runat="server" Text="Novo"  /></td>
                                    </tr>
                                </table>
                          </fieldset>
                    </td>
                </tr>
            </table>
        </td>
       </tr>
       <tr>
        <td style="width: 100%;">
            <table cellpadding="0" cellspacing="0" width="100%">
                <tr>
                    <td style="width: 100%;">
                        <asp:GridView ID="grdPortas" runat="server" AutoGenerateColumns="False" 
                            Width="100%" AllowPaging="True" AllowSorting="True" 
                            onpageindexchanging="grdPortas_PageIndexChanging" 
                            onrowdatabound="grdPortas_RowDataBound" onsorting="grdPortas_Sorting" 
                            PageSize="30">
                            <Columns>
                                <asp:BoundField DataField="Nome" HeaderText="Módulo" SortExpression="Nome" >
                                    <ControlStyle Width="20%" />
                                    <HeaderStyle Width="20%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Submodulo" HeaderText="Sub Módulo" 
                                    SortExpression="Submodulo" >
                                    <ControlStyle Width="20%" />
                                    <HeaderStyle Width="20%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Servico" HeaderText="Serviço" 
                                    SortExpression="Servico" >
                                    <ControlStyle Width="20%" />
                                    <HeaderStyle Width="20%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="Porta" HeaderText="Porta" SortExpression="Porta" >
                                    <ControlStyle Width="20%" />
                                    <HeaderStyle Width="20%" />
                                </asp:BoundField>
                                <asp:BoundField DataField="PortaMex" HeaderText="Porta Mex" 
                                    SortExpression="PortaMex" >
                                    <ControlStyle Width="20%" />
                                    <HeaderStyle Width="20%" />
                                </asp:BoundField>
                            </Columns>
                        </asp:GridView>
                    
                    </td>
                </tr>
            </table>
        </td>
       </tr>
    </table>
    </form>
</body>
</html>
